<?php
App::uses('AppModel', 'Model');
/**
 * Utilisateur Model
 *
 * @property devis $devis
 * @property questionnaires $questionnaires
 */
class Utilisateur extends AppModel {
/**
 * Primary key field
 *
 * @var string
 */
	public $primaryKey = 'id_utilisateur';
/**
 * Display field
 *
 * @var string
 */
	public $displayField = 'login';
/**
 * Validation rules
 *
 * @var array
 */
	public $validate = array(
		'id_utilisateur' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'nom_utilisateur' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Ce champ doit être renseigné.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'login' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Ce champ doit être renseigné.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
						'unique' => array(
								'rule' => 'isUnique',
								'message' => 'Ce nom d\'utilisateur existe déjà.'
						)
		),
		'password' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Ce champ doit être renseigné.',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'role_admin' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed

/**
 * hasMany associations
 *
 * @var array
 */
	public $hasMany = array(
		'devis' => array(
			'className' => 'devis',
			'foreignKey' => 'id_utilisateur',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'questionnaires' => array(
			'className' => 'questionnaires',
			'foreignKey' => 'id_utilisateur',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
